package tw.zld369504.wol.base;

import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import tw.zld369504.wol.R;

/**
 * Basic activity
 */
public class BaseActivity extends AppCompatActivity {
    private ProgressDialog pd;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        pd=new ProgressDialog(this);
        pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        pd.setCancelable(false);
        pd.setCanceledOnTouchOutside(false);
        pd.setMessage(getString(R.string.progress_waiting));
    }

    public void t(String toastStr){
        Toast.makeText(this,toastStr,Toast.LENGTH_SHORT).show();
    }

    public void showProgressDialog(){
        this.pd.show();
    }

    public void dismissProgressDialog(){
        this.pd.dismiss();
    }
}
